package kr.saeildamil.androidStudy_second.fragment;

import kr.saeildamil.androidStudy_second.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class FragmentMgn01 extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch20_fragmentmgn);
		
		//방법 6: 액티비티가 프래그먼트의 핸들러 설치
		Button btnIncrease = (Button) findViewById(R.id.ch20_counterfrag_btn);
		final TextView textcounter = (TextView) findViewById(R.id.ch20_counterfrag_text);
		
		btnIncrease.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				int count = Integer.parseInt(textcounter.getText().toString());
				textcounter.setText(Integer.toString(count + 1));
				
			}
		});
		
	}

}
